<template>
  <el-select v-model="dataForm.status" placeholder="请选择">
    <el-option
      v-for="item in statusOptions"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>
</template>

<script>
export default {
  name: 'pruchaseStatusComponent',
  props: ['status'],
  data () {
    return {
      //采购状态[0新建，1已分配，2正在采购，3已完成，4采购失败]

      statusOptions: [
        {
          label: '新建',
          value: 0,
          type: ''
        }, {
          label: '已领取',
          value: 1,
          type: 'success'
        }, {
          label: '正在采购',
          value: 2,
          type: 'info'
        }, {
          label: '已完成',
          value: 3,
          type: 'warning'
        }, {
          label: '有异常',
          value: 4,
          type: 'danger'
        }
      ],
      dataForm: {
        status: null
      }
    }
  },
  watch: {
    'dataForm.status' (val) {
      this.$emit('update-purchase-status', val)
    },
    status (val) {
      this.dataForm.status = val
    }
  }
}
</script>

<style scoped>

</style>
